package com.likui.myqq.task;

import android.os.AsyncTask;
import android.view.View;

import com.likui.myqq.R;
import com.likui.myqq.view.LoadingView;

/**
 * Created by helikui on 2015/9/30.
 */
public class AsyncTaskBase extends AsyncTask<Integer, Integer, Integer> {
    private LoadingView loadingView;

    public AsyncTaskBase(LoadingView loadingView) {
        this.loadingView = loadingView;
    }

    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        loadingView.setVisibility(View.VISIBLE);
    }

    @Override
    protected void onPostExecute(Integer integer) {
        super.onPostExecute(integer);
        if (integer == 1) {
            loadingView.setVisibility(View.GONE);
        } else {
            loadingView.setText(R.string.no_data);
        }
    }

    @Override
    protected Integer doInBackground(Integer... params) {
        return null;
    }
}
